// pagesDoctor/clinicalDiagnosisDeputy/index.js
Page({

  /**
   * 页面的初始数据
   */
  data: {
    list: [{
      id: '1',
      name: '鼠疫',
      code: 'SY',
      checked: false
    }, {
      id: '2',
      name: '炭疽',
      code: 'TJ',
      checked: false
    }, {
      id: '3',
      name: '鼻疽',
      code: 'BJ',
      checked: false
    }, {
      id: '4',
      name: '麻风',
      code: 'MF',
      checked: false
    }, {
      id: '5',
      name: '伤寒',
      code: 'SH',
      checked: false
    }, {
      id: '6',
      name: '霍乱',
      code: 'HL',
      checked: false
    }, {
      id: '7',
      name: '肾结核',
      code: 'SJH',
      checked: false
    }, {
      id: '8',
      name: '肠结核',
      code: 'CJH',
      checked: false
    }, {
      id: '9',
      name: '眼结核',
      code: 'YJH',
      checked: false
    }, {
      id: '10',
      name: '舌结核',
      code: 'SJH',
      checked: false
    }]
  },


  onChange(e) {
    let index = e.currentTarget.dataset.info
    this.data.list[index].checked = e.detail
    this.setData({
      list: this.data.list
    })


  },

  submitBtn(e) {
    //确认按钮进行提交
    let name = []
    this.data.list.forEach(item => {
      if (item.checked == true) {
        name.push(item.name)
      }
    })
    let pages = getCurrentPages();
    let prevPage = pages[pages.length - 2];
    prevPage.setData({
      type: name.toString()
    })
    wx.navigateBack({
      delta: 1,
    })
  },
  /**
   * 生命周期函数--监听页面加载
   */
  onLoad(options) {

  },

  /**
   * 生命周期函数--监听页面初次渲染完成
   */
  onReady() {

  },

  /**
   * 生命周期函数--监听页面显示
   */
  onShow() {

  },

  /**
   * 生命周期函数--监听页面隐藏
   */
  onHide() {

  },

  /**
   * 生命周期函数--监听页面卸载
   */
  onUnload() {

  },

  /**
   * 页面相关事件处理函数--监听用户下拉动作
   */
  onPullDownRefresh() {

  },

  /**
   * 页面上拉触底事件的处理函数
   */
  onReachBottom() {

  },

  /**
   * 用户点击右上角分享
   */
  onShareAppMessage() {

  }
})